package com.chinalwb.are.demo;

import com.chinalwb.are.utils.PxUtil;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.app.Context;
import org.junit.Assert;
import org.junit.Test;

/**
 * ExampleOhosTest
 *
 * @since 2021/06/22
 */
public class ExampleOhosTest {

    Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
    /**
     * fp2px
     */
    @Test
    public void PixelUtil_fp2px() {
        PxUtil.initContext(context);
        float px = PxUtil.fp2px(10 , context);
        Assert.assertEquals(30.0, px, 0.0);
    }

    /**
     * vp2px
     */
    @Test
    public void PixelUtil_vp2px() {
        PxUtil.initContext(context);
        float px = PxUtil.vp2px(10 , context);
        Assert.assertEquals(30.0, px, 0.0);
    }


}